package com.yanxu.design01_singleton.destroy.serialize_destory;

import java.io.ObjectStreamException;
import java.io.Serializable;

/**
 * @author 折戟沉沙铁未销
 * @version V1.0
 * @date 2025/4/14-2025
 * @Description: 饿汉式 - 单例模式
 */
public class HungryInstance implements Serializable {

    private static HungryInstance instance = new HungryInstance();

    private HungryInstance() {

    }

    public static HungryInstance getInstance() {
        return instance;
    }


    private Object readResolve() throws ObjectStreamException {
        return instance;
    }

}